/***************************************************************************************
 *   This software simulated for ARPEES, a routing protocol for Wireless Sensor Network *
 *   Copyright (C) 2007 by Tran Quang Vinh (vinhtq@mail.hut.edu.vn)                     *
 *   Multimedia Information NETwork Lab - MINET                                         *
 *   Dept. Electronic Information Systems, Graduate School of Enginnering               *
 *   Shibaura Institute of Technology, Japan.                                           *
 *--------------------------------------------------------------------------------------*
 *   File name: ArpeesDef.h                                                             *
 *   header file for definitions using in the protocol                                  *
 ************************************************************************************/

#ifndef ARPEESDIF_H
#define ARPEESDIF_H

#define NANO 0.001
#define PICO 0.000001
#define M_PI 3.1415926535

#define NUMBERNODES  1500
#define NUMBERROUND  1000
#define MAXEVENTS    50         // max number of events
#define MAXNEIGHBORS 50

#define SIGNAL      25*8        // 25 bytes
#define DATA        500*8       // 500 bytes
#define SIGNAL2BS   25

// node status
#define STATUS_LIVE       1
#define STATUS_DEAD       2
#define STATUS_REDUN      3

// messagetypes for clusters
#define CL_TOBS           3
#define CL_TOHEAD         4
#define CL_TDMA           5
#define CL_CHDATA         6
#define CL_RNDATA         7
#define CL_DATA_RN2BS       8
#define CL_TO_FREE_NODE     18
#define CL_TO_REDUN_NODE    19
#define CL_TO_DEAD_NODE     20

// self message types
#define SMSG_DATA2RNBS      9       // cluster head sends data to RN/BS
#define SMSG_DATA_NODE2CH   10      // node send data to cluster head
#define SMSG_STATUS2BS      14      // nodes send their new status to BS
#define SMSG_INIT           15      // init updates
#define SMSG_MAKETDMA       16
#define BROADCAST           17

//my self message type
#define MSG_CHADV           86
#define MSG_STATUSINFO      87
#define MSG_INIT            88
#define MSG_CREATE_CH       89
#define MSG_DATA2RN         90
#define MSG_REQRN           91
#define MSG_ACKRN           92
#define MSG_TDMA            93
#define MSG_DATA2CH         94
#define MSG_CLUSTERJOIN     95
#define MSG_RESET_AND_GEN   96
#define MSG_ENDROUND        97
#define MSG_MY_GEN_EVENT    98

//WSN Node status
//#define DEATH 100
//#define ALIVE 101
#define STT_IS_NORMAL 102
#define STT_IS_MEMBER 103
#define STT_IS_CH 104
#define STT_IS_DEATH 105

//WSN transmit ype
#define RECEIVE 200
#define TRANSMIT 201

//protocol
#define MLEACH  301
#define ARPEES  302
#define MYPROTOCOL  303
//
#define FMAX    200000

struct _adv {
    int id;
    double energy;
    int status;
    int xpos;
    int ypos;
    double kd;
    int delay; //mirco-second
    int hop;
};
// define some events and times
#define INIT_WAIT   1     // wait to init nodes
#define ON          1
#define OFF         0

#endif
/************************************************************************************/

